/**
 * ...
 * @author Krzysztof Rozalski
 */

package hapi.physics.integration;
import hapi.math.Angle;
import hapi.math.Vector2D;
import hapi.physics.AngularVelocity;
import hapi.physics.Mass;
import hapi.physics.Momentum;
import hapi.physics.Velocity;
import hapi.physics.Time;
import hapi.physics.Acceleration;

class Integrateable {
	
	public var position:Vector2D;
	public var velocity:Velocity;
	public var angle:Angle;
	public var angularVelocity:AngularVelocity;
	
	public function new(position, velocity, angle, angularVelocity) {
		this.position = position;
		this.velocity = velocity;
		this.angle = angle;
		this.angularVelocity = angularVelocity;
	}
	
	public static function createWithPosition(position):Integrateable {
		return new Integrateable(position, Velocity.zero(), new Angle(0), AngularVelocity.zero());
	}
	
	public inline function derivative(dervaiteToApply:Derivative, delta:Time):Integrateable {
		var target:Integrateable = clone();
		dervaiteToApply.applyTo(target, delta);
		return target;
	}
	
	public function clone():Integrateable {
		return new Integrateable(position.clone(), velocity.clone(), angle.clone(), angularVelocity.clone());
	}
}
